package com.cskaoyan.javase.oop2._2polymorphic._2advantage;
/**
 * 所以强转能够成功的前提条件是：引用所指向的真实对象，必须是强转后的引用能够指向的对象。所以可以是强转后的引用的类型的对象或者子类对象
 *
 * @since 11:29
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Demo3 {
    public static void main(String[] args) {
        Grandfather gf = new Grandson();
        // gf能够强转成哪些引用呢?
        // Grandson2 gf1 = (Grandson2) gf;
        Father f = (Father) gf;
        Grandson g = (Grandson) gf;
    }
}
class Grandfather{}
class Father extends Grandfather{}
class Grandson extends Father{}
class Grandson2 extends Father{}
